package office.bo.business.impl;

import java.util.Date;

import current.security.user.domain.User;

import office.bo.business.IContract;
import office.domainset.BizDomainProviderSetImpl;
import platform.common.bo.PersistenceBO;
import platform.common.dao.IDomainProviderSet;
import platform.common.exception.BusinessException;
/**
 * 合同管理
 * @author ZhangYQ
 * 合同执行
 * 签合同 备货 发货 开发票 回款
 * 在备货的 时候 需填写 备货单 并且打印
 * 在发货的 时候 须填写 发货单 并且打印
 * 执行的时候是可以在未签订合同的情况进行备货的后续流程的，但是要给上级发送提醒。
 *
 */
public class Contract extends PersistenceBO implements IContract {
	private static final long serialVersionUID = 1L;
	/** 合同名称 */
	private String contractName;
	/**合同编码*/
	private String contractCode;
	/**合同金额*/
	private double contractMoney;
	/**合同类型 1：正常合同，2：采购合同*/
	private String contractType;
	/** 合同签订日期 */
	private Date signDate;
	/**对应的标书*/
	private String bidBookId;
	/**项目名称*/
	private String projectName;
	/**项目单位*/
	private String projectUnit;
	/**联系人*/
	private String linkMan;
	/**电话*/
	private String telePhone;
	/**业务员*/
	private String salesMan;
	/**质保金额*/
	private double qualityMoney;
	/**是否签订合同*/
	private String isSign;
	/**是否备货*/
	private String isStockUp;
	/**是否发货*/
	private String isDelivery;
	/**是否开发票*/
	private String isInvoice;
	/**汇款金额*/
	private double remitMoney;
	private String salesManName;
	private String createMan;  //创建人
	/**
	 * 合同所属状态 0：表示新建的合同，1：表示已备货
	 * 2：表示已发货，3:表示已开发票，4：表示已回款 10：表示合同已归档
	 */
	private String  status;
	/**
	 * 如果为采购合同、则有以下此字段
	 */
	/**供货单位*/
	private String availabilityUnit;
	/**发货日期*/
	private Date deliveryDate;
	
	/**
	 * 获取用户对象
	 * @param domainProviderSet
	 * @return
	 * @throws BusinessException
	 */
	public User getUser(IDomainProviderSet domainProviderSet) throws BusinessException{
		User user=null;
		try {
			BizDomainProviderSetImpl domainProviderSetImpl = (BizDomainProviderSetImpl) domainProviderSet;
			if(this.salesMan==null){
				return null;
			}
			user=(User)domainProviderSetImpl.getDao().findByIdAndDomain(domainProviderSetImpl.getUserDP(), this.salesMan);
		} catch (Exception e) {
			throw this.handleBusinessBOException(e);
		}
		return user;
	}
	//（产品名称 数量 单位 单价 总价 ）
	public String getContractCode() {
		return contractCode;
	}
	public String getContractName() {
		return contractName;
	}
	public void setContractName(String contractName) {
		this.contractName = contractName;
	}
	public void setContractCode(String contractCode) {
		this.contractCode = contractCode;
	}
	public double getContractMoney() {
		return contractMoney;
	}
	public void setContractMoney(double contractMoney) {
		this.contractMoney = contractMoney;
	}
	public Date getSignDate() {
		return signDate;
	}
	public void setSignDate(Date signDate) {
		this.signDate = signDate;
	}
	public String getBidBookId() {
		return bidBookId;
	}
	public void setBidBookId(String bidBookId) {
		this.bidBookId = bidBookId;
	}
	
	public String getProjectName() {
		return projectName;
	}
	public void setProjectName(String projectName) {
		this.projectName = projectName;
	}
	public String getProjectUnit() {
		return projectUnit;
	}
	public void setProjectUnit(String projectUnit) {
		this.projectUnit = projectUnit;
	}
	public String getLinkMan() {
		return linkMan;
	}
	public void setLinkMan(String linkMan) {
		this.linkMan = linkMan;
	}
	public String getTelePhone() {
		return telePhone;
	}
	public void setTelePhone(String telePhone) {
		this.telePhone = telePhone;
	}
	public String getSalesMan() {
		return salesMan;
	}
	public void setSalesMan(String salesMan) {
		this.salesMan = salesMan;
	}
	public double getQualityMoney() {
		return qualityMoney;
	}
	public void setQualityMoney(double qualityMoney) {
		this.qualityMoney = qualityMoney;
	}
	public String getIsSign() {
		return isSign;
	}
	public void setIsSign(String isSign) {
		this.isSign = isSign;
	}
	public String getIsStockUp() {
		return isStockUp;
	}
	public void setIsStockUp(String isStockUp) {
		this.isStockUp = isStockUp;
	}
	public String getIsDelivery() {
		return isDelivery;
	}
	public void setIsDelivery(String isDelivery) {
		this.isDelivery = isDelivery;
	}
	public String getIsInvoice() {
		return isInvoice;
	}
	public void setIsInvoice(String isInvoice) {
		this.isInvoice = isInvoice;
	}
	public double getRemitMoney() {
		return remitMoney;
	}
	public void setRemitMoney(double remitMoney) {
		this.remitMoney = remitMoney;
	}
	public String getContractType() {
		return contractType;
	}
	public void setContractType(String contractType) {
		this.contractType = contractType;
	}
	public String getAvailabilityUnit() {
		return availabilityUnit;
	}
	public void setAvailabilityUnit(String availabilityUnit) {
		this.availabilityUnit = availabilityUnit;
	}
	public Date getDeliveryDate() {
		return deliveryDate;
	}
	public void setDeliveryDate(Date deliveryDate) {
		this.deliveryDate = deliveryDate;
	}
	public String getStatus() {
		return status;
	}
	public void setStatus(String status) {
		this.status = status;
	}
	public String getSalesManName() {
		return salesManName;
	}
	public void setSalesManName(String salesManName) {
		this.salesManName = salesManName;
	}
	public String getCreateMan() {
		return createMan;
	}
	public void setCreateMan(String createMan) {
		this.createMan = createMan;
	}
}
